﻿using System;
using System.Collections.Generic;
using Model;
using Model.EF;

public partial class System_Role_SubRoleList : System.Web.UI.Page
{
    #region 分页变量，与UI绑定
    private int numPerPage;
    /// <summary>
    /// 每页显示的条数
    /// </summary>
    public int NumPerPage
    {
        get
        {
            int temp = Convert.ToInt32(Request.Form["numPerPage"]);
            return temp == 0 ? 20 : temp;
        }
        set { numPerPage = value; }
    }

    private int pageNumShown = 10;
    /// <summary>
    /// 页数导航的个数
    /// </summary>
    public int PageNumShown
    {
        get { return pageNumShown; }
        set { pageNumShown = value; }
    }

    private int pageNum;
    /// <summary>
    /// 当前显示的页数
    /// </summary>
    public int PageNum
    {
        get
        {
            int temp = Convert.ToInt32(Request.Form["pageNum"]);
            return temp == 0 ? 1 : temp;
        }
        set { pageNum = value; }
    }

    private int totalCount;
    /// <summary>
    /// 总条数
    /// </summary>
    public int TotalCount
    {
        get { return totalCount; }
        set { totalCount = value; }
    }

    private string keywords;
    /// <summary>
    /// where语句，不加where与空格
    /// </summary>
    public string Keywords
    {
        get
        {
            string temp = Request.Form["keywords"];
            return temp;
        }
        set { keywords = value; }
    }

    private string orderField;
    /// <summary>
    /// 排序关键字
    /// </summary>
    public string OrderField
    {
        get
        {
            string temp = Request.Form["orderField"];
            return temp;
        }
        set { orderField = value; }
    }
    #endregion
    public string rid = "";
    protected string rel = "";

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["rid"] != null)
        {
            rid = Request.QueryString["rid"].ToString();
        }
        rel = Request.QueryString["rel"].ToString();
        IRepository<SystemMenu> MenuRepository = new EntityRepository<SystemMenu>();

        string queryString = string.Format("SELECT * FROM SystemMenus as it WHERE it.PMenuID={0} order by it.OrderBy desc", Request.QueryString["id"].ToString());

        int Count;
        IList<SystemMenu> list = MenuRepository.FindPageList(queryString, PageNum, NumPerPage, out Count);
        TotalCount = Count;

        RepeaterTr.DataSource = list;
        RepeaterTr.DataBind();
    }
}